class_name 妖术Operation extends Node

var operationManager:OperationManager
var big:Big

func init(om:OperationManager):
	self.operationManager = om
	return self


func preparation_妖术_敲山震虎():
	operationManager.arr_listeningPoints.clear()
	var point = operationManager.selectedPoint
	var arrAroundPoints = GameUtils.getArrPointsHasView()
	for p in arrAroundPoints:
		if p.real_terrain == 1:
			operationManager.arr_listeningPoints.append(p)
	GameUtils.neatAnimation()
	big = point.big
	big.detailHide()

func preparation_妖术_绝命献祭():
	operationManager.arr_listeningPoints.clear()
	var point = operationManager.selectedPoint
	var arrAroundPoints = GameUtils.getArrPointsHasView()
	for p in arrAroundPoints:
		if p.big != null:
			if p.big.player.is_me:
				operationManager.arr_listeningPoints.append(p)
	GameUtils.neatAnimation()
	big = point.big
	big.detailHide()

func preparation_妖术_玄冰禁锢():
	operationManager.arr_listeningPoints.clear()
	var point = operationManager.selectedPoint
	var arrAroundPoints = GameUtils.getArrPointsHasView()
	for p in arrAroundPoints:
		if p.is_view:
			if p.small != null:
				continue
			if p.big != null && p.big.player.is_me:
				continue
		operationManager.arr_listeningPoints.append(p)
	GameUtils.neatAnimation()
	big = point.big
	big.detailHide()

func preparation_妖术_瘟疫传播():
	operationManager.arr_listeningPoints.clear()
	var point = operationManager.selectedPoint
	var arrAroundPoints = GameUtils.getArrPointsHasView()
	for p in arrAroundPoints:
		if p.is_view:
			if Terrain.jing == p.real_terrain:
				continue
			if p.small != null:
				continue
			if p.big != null && p.big.player.is_me:
				continue
		operationManager.arr_listeningPoints.append(p)
	GameUtils.neatAnimation()
	big = point.big
	big.detailHide()


func 妖术_敲山震虎(point:Point):
	WebSocketManager.sendObj(true,"妖术_敲山震虎",{"start":big.point.id,"end":point.id})
	operationManager.cancel()

func 妖术_绝命献祭(point:Point):
	WebSocketManager.sendObj(true,"妖术_绝命献祭",{"start":big.point.id,"end":point.id})
	operationManager.cancel()

func 妖术_玄冰禁锢(point:Point):
	WebSocketManager.sendObj(true,"妖术_玄冰禁锢",{"start":big.point.id,"end":point.id})
	operationManager.cancel()

func 妖术_瘟疫传播(point:Point):
	WebSocketManager.sendObj(true,"妖术_瘟疫传播",{"start":big.point.id,"end":point.id})
	operationManager.cancel()
